<!--
 * @Description: 页面布局
 * @Author: liushuang
 * @Date: 2022-03-28 18:11:18
 * @LastEditTime: 2022-12-02 18:23:13
-->
<template>
  <div class="app_page" @dragover="dragover">
    <!-- 顶部 -->
    <Header />
    <div class="app_main">
      <!-- 侧边栏 -->
      <!-- routeMeta.sidebar 是否有侧边栏 -->
      <!-- routeMeta.suspension 是否悬浮 -->
      <!-- routeMeta.padding 是否有边距 -->
      <Sidebar
        v-show="routeMeta.sidebar !== false"
        :class="{ suspension: routeMeta.suspension }"
        :suspension="routeMeta.suspension"
      />
      <!-- 页面内容 -->
      <div
        class="app_content"
        :class="{ 'box-no-padding': !routeMeta.padding }"
      >
        <!-- <Tags /> -->
        <div
          class="app_container"
          :class="{ 'no-border-container': routeMeta.suspension }"
        >
           <RouterView>
            <template #default="{ Component, route }">
              <!-- <pre>{{ route.meta }}</pre> -->
              <transition name="move" mode="out-in">
                <keep-alive>
                  <component
                    v-if="route.meta.keepAlive"
                    :is="Component"
                    :key="route.fullPath"
                  />
                </keep-alive>
              </transition>
                <component
                  v-if="!route.meta.keepAlive"
                  :is="Component"
                  :key="route.fullPath"
                />
            </template>
          </RouterView>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import Header from './components/Header/index.vue'
import Sidebar from './components/Sidebar/index.vue'

const route = useRoute()
const routeMeta = computed(() => route.meta)

</script>
<style scoped>
.app_page {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.app_main {
  display: flex;
  width: 100%;
  flex: 1;
  overflow: hidden;
  /* background-image: url('@/assets/image/map_bk.jpg'); */
  background-size: 100%;
  background-repeat: no-repeat;
}
.app_content {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  transition: left 0.3s ease-in-out;
  overflow: hidden;
  padding: 16px;
  /* background-image: url('@/assets/image/map_bk.jpg');
  background-size: 100% 100%;
  background-repeat: no-repeat; */
}
.box-no-padding {
  padding: 0px !important;
}
.app_container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  /* background: linear-gradient(
    180deg,
    #526079 0%,
    rgba(125, 142, 171, 0.2) 100%
  ); */
  /* background: linear-gradient(180deg, #374560 0%, rgba(55, 69, 96, 0.9) 100%); */
  background: #f5f5f5;
}

.no-border-container {
  border: none !important;
  border-radius: 0;
}

.suspension {
  position: absolute;
  margin-top: 10px;
  z-index: 10;
  height: 721px;
  background: linear-gradient(180deg, #374560 0%, rgba(55, 69, 96, 0) 100%);
  border-top-right-radius: 26px;
  overflow: hidden;
}
</style>
